package com.ken.chapter10

import com.sun.javafx.animation.TickCalculation.sub


fun main(arg: Array<String>) {
    println(calculate(10,5,'+'))
    println(sub(10,5))
}

fun calculate(n1: Int, n2: Int, c: Char) :Int{
      var n3 = 2
    fun add(a:Int,b:Int):Int{

        return (a+b)*n3
    }
    fun sub(a:Int,b:Int):Int = (a-b)*n3

    return if (c == '+')add(n1,n2)else sub(n1,n2)
}